package com.bkgy.modular.tbscoretcm.controller;

import com.alibaba.fastjson.JSONObject;
import com.bkgy.modular.tbscoretcm.entity.TbScoreTcm;
import com.bkgy.modular.tbscoretcm.service.TbScoreTcmService;
import com.bkgy.sys.common.entity.ResultData;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/tbScoreTcm")
public class TbScoreTcmController {


    @Resource
    private TbScoreTcmService tbScoreTcmService;

    @PostMapping("/updateTbScoreTcm")
    public ResultData updateTbScoreTcm(@RequestBody String data){
        try {
            TbScoreTcm tbScoreTcm = JSONObject.parseObject(data, TbScoreTcm.class);
            tbScoreTcmService.updateById(tbScoreTcm);
            return ResultData.ResultDataSuccessSelf("修改成功", null);
        }catch (Exception e){
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("修改失败,失败信息为" + e.getMessage(), null);
        }
    }

}
